﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace PwdMgrUI.ValidationRules
{
    public class CommonStringValidationRule : ValidationRule
    {
        private string _errMsg;

        public string ErrMsg
        {
            get { return _errMsg; }
            set { _errMsg = value; }
        }

        public override ValidationResult Validate(
            object value, CultureInfo cultureInfo)
        {
            string strVal = value as string;
            if (string.IsNullOrEmpty(strVal))
                return new ValidationResult(false, ErrMsg);

            return new ValidationResult(true, null);
        }
    }
}
